<%@ page import="java.util.List" %>
<%@ page import="com.workmanager.bean.*" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: YIJIE
  Date: 2016/8/25
  Time: 22:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../inc/top.jsp"%>
<link href="<%=ctxpath%>/static/student/css/feedback.css" rel="stylesheet" />
<script src="<%=ctxpath%>/static/student/js/studentWork.js"></script>
<%
    WorkBean work = (WorkBean) request.getAttribute("awork");
    List<EvaluateBean> evaluates = (List<EvaluateBean>) request.getAttribute("aevaluate");
    List<FeedbackBean> feedbacks = (List<FeedbackBean>) request.getAttribute("feedbacks");
%>
<form name="feedbackForm" method="post" id="feedbackForm" action="<%=ctxpath%>/StudentWorkController/giveFeedback.wm">
    <input name="work_id" id="work_id" type="hidden" value="${awork.work_id}" />
    <div >
        <div class="contentInfo">
            <span>作业编号：<%=work.getJobTask_id()%></span>
            <span>作业名称：<%=work.getWork_title()%></span>
            <span>提交时间：<%=work.getWork_date()%></span>
        </div>
        <hr />
        <ul class="king-timeline-simple">
        <%
            if(feedbacks!=null||evaluates!=null){
                int j=0;
                for(int i=0;i<feedbacks.size();i++){
                    if(j<evaluates.size()){
                        Date evaltime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(evaluates.get(j).getSubmit_time());
                        Date fdbktime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(feedbacks.get(i).getFeedback_time());
                        if(evaltime.getTime()>fdbktime.getTime()) {
        %>

            <li class="primary">
                <div class="timeline-simple-wrap">
                    <%=feedbacks.get(i).getFeedback_content()%>
                    <span class="timeline-simple-date">学生（<%=feedbacks.get(i).getFeedback_time()%>）</span>
                </div>
            </li>
        <%}else{
        %>
            <li class="warning">
                <div class="timeline-simple-wrap">
                    <%=evaluates.get(j).getEvaluate()%>
                    <span class="timeline-simple-date">老师（<%=evaluates.get(j).getSubmit_time()%>）</span>
                </div>
            </li>
        <%
                j++;
                i--;
            }
        }else{
        %>
            <li class="primary">
                <div class="timeline-simple-wrap">
                    <%=feedbacks.get(i).getFeedback_content()%>
                    <span class="timeline-simple-date">学生（<%=feedbacks.get(i).getFeedback_time()%>）</span>
                </div>
            </li>
        <%
                }
            }
            if(j<evaluates.size()){
                for(int m=j;m<evaluates.size();m++){
        %>
            <li class="warning">
                <div class="timeline-simple-wrap">
                    <%=evaluates.get(m).getEvaluate()%>
                    <span class="timeline-simple-date">老师（<%=evaluates.get(m).getSubmit_time()%>）</span>
                </div>
            </li>
        <%
                    }
                }
            }
        %>
        <hr />我要反馈
        <div class="feedInfo">
            <textarea rows="5" type="text" name="feedInfo" id="feedInfo"></textarea>
        </div>
        <div class="clickInfo">
            <button class="btn btn-primary" type="button" id="feedback" name="feedback">提交反馈</button>
            <a href="<%=ctxpath%>/StudentWorkController/getMywork.wm?student_id=${awork.student_id}" class="btn btn-info">返回</a>
        </div>
            </ul>
    </div>
</form>
<%@include file="../inc/bottom.jsp"%>
